package com.example.xd.tuiliu_test.videoplayer.widget.status;

import android.view.View;

import com.example.xd.tuiliu_test.R;
import com.example.xd.tuiliu_test.videoplayer.widget.BasePlayerView;

import tv.danmaku.ijk.media.player.IMediaPlayer;


public class PauseStatus extends BaseStatus {
    public PauseStatus(BasePlayerView view) {
        super(view);
    }

    @Override
    public void play() {
        view.iv_video_pic.setVisibility(View.GONE);
        view.iv_screen_play.setVisibility(View.GONE);
        view.seek_play.setImageResource(R.drawable.pause);
        view.player.start();
        view.removeLoading();
        view.setStatus(view.playing);
    }

    @Override
    public void error() {
        view.player.stop();
        view.iv_screen_play.setImageResource(R.drawable.error);
        view.iv_screen_play.setVisibility(View.VISIBLE);
        view.setStatus(view.error);
    }

    @Override
    public void completed() {

    }

    @Override
    public void onInfo(IMediaPlayer iMediaPlayer, int what, int i1) {

    }

    @Override
    public void netChange() {

    }

    public void restoreFromPlayerView() {
        view.iv_video_pic.setVisibility(View.GONE);
        view.iv_screen_play.setVisibility(View.GONE);
        view.seek_play.setImageResource(R.drawable.pause);
        view.player.start();
        view.removeLoading();
        view.setStatus(view.playing);
    }

    @Override
    public void onBack() {
        view.setStatus(view.backPause);
    }

    @Override
    public void onStart() {

    }

    @Override
    public void copyStatusToChild(BasePlayerView view) {
        view.setStatus(view.pause);
    }
}
